using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class SingleAndMultSelect : MonoBehaviour
{
    public Rect toggleRect; // 开关的配置

    public Rect voiceToggleRect;
    // 默认为false
    private bool maxQualityOpen;
    private bool voiceOpen; // 是否静音
    public GUIStyle voiceToggleStyle;

    public Rect option1Rect;
    public Rect option2Rect;
    public Rect option3Rect;

    public byte activeIndex;

    private void OnGUI()
    {
        // 这个绑定值会一直刷新
       maxQualityOpen = GUI.Toggle(toggleRect, maxQualityOpen, "是否开启最高画质");  // 绘制开关, 并监听状态
       voiceOpen = GUI.Toggle(voiceToggleRect, voiceOpen, "是否开启声音", voiceToggleStyle); // 自定义样式
       
       // 绑定值是bool类型, 实现选项切换
       if (GUI.Toggle(option1Rect, activeIndex == 1, "选项1"))
       {
           activeIndex = 1;
       }

       if (GUI.Toggle(option2Rect, activeIndex == 2, "我是选项2"))
       {
           activeIndex = 2;
       }
       if (GUI.Toggle(option3Rect, activeIndex == 3, "我是选项3"))
       {
           activeIndex = 3;
       }
    }
}